<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--
  Created by IntelliJ IDEA.
  User: gu
  Date: 2021/7/15
  Time: 10:48 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>可修改编码列表</title>
    <%
        /********** 保存网站的基本路径 ***********/
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                + path + "/";
        //将该路径地址缓存到 session中 ,例如：http://localhost:8090/tjnu_ssh_1128/
        session.setAttribute("mybasePath", basePath);

    %>
    <!-- CSS -->
    <jsp:include page="../include/headtag.jsp" />
    <!-- <link rel="stylesheet"
        href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500"> -->
    <link rel="stylesheet"
          href="${mybasePath}assets/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${mybasePath}assets/css/form-elements.css">
    <link rel="stylesheet" href="${mybasePath}assets/css/style.css">
</head>
<body>
<jsp:include page="../include/head.jsp" />
<jsp:include page="../include/menu.jsp" />
<div id="page-wrapper" style="margin-top: 50px;">
    <div id="page-inner">
        <div class="text-left">
            <a href="/index">首页</a>&nbsp;&gt;&nbsp;<a href="/codeManageIndex" class="acts CurrChnlCls">编码管理</a>&nbsp;&gt;&nbsp;<a href="/codeChangeList" class="acts CurrChnlCls">可修改编码列表</a>
        </div>
        <div class="row">
            <div class="col-md-12">
                <h3 class="text-left">可修改编码列表</h3>
            </div>
        </div>
        <hr />
        <table class="table table-striped table-hover">
            <thead>
            <tr>
                <th style="text-align: center;">规则序号</th>
                <th style="text-align: center;">规则类别</th>
                <th style="text-align: center;">规则名称</th>
                <th style="text-align: center;">码段数量</th>
                <th style="text-align: center;">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="codeRule" items="${codeRules}" varStatus="s">
                <tr>
                    <td>${codeRule.codeRuleId}</td>
                    <td>${ruleCategories[codeRule.ruleCategoryId-1].ruleCategoryName}</td>
                    <td>${codeRule.codeRuleName}</td>
                    <td>${codeRule.codeCodeCount}</td>
                    <td>
                        <a onclick="redirToCodeRuleInfo(${codeRule.codeRuleId})" class="btn btn-primary btn-sm ">规则详情</a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
        <c:if test="${pages.totalPage > 0}">
            <ul class="pagination pagination-lg">
                <li <c:if test="${pages.currentPage < 1}">class="disabled"</c:if>><a
                        href="#">&laquo;</a></li>
                <c:forEach begin="${pages.pageNumStart }" end="${pages.pageNumEnd }"
                           varStatus="status">
                    <li
                            <c:if test="${status.index == pages.currentPage }">class="active"</c:if>>
                        <a href="javascript:void(0);" onclick="tijiao('${status.index }')">
                                ${status.index } </a>
                    </li>
                </c:forEach>
                <li
                        <c:if test="${pages.currentPage> pages.totalPage}">class="disabled"</c:if>><a
                        href="javascript:void(0);" onclick="tijiao('${pages.nextPage }')">&raquo;</a></li>
                <li><input id="tijiaoInput" name="tijiaoInput" type="text"
                           class="form-control col-md-1" style="width: 60px; height: 54.89px;"></li>
                <li><a onclick="tijiaoInput()">Go</a></li>
                <li class="disabled"><a>共${pages.totalPage}页${pages.totalRecord}条记录</a>
            </ul>
        </c:if>
    </div>

    <!-- /. PAGE INNER  -->
</div>
<!-- /. PAGE WRAPPER  -->

</body>
<!-- Javascript -->
<script src="${mybasePath}assets/bootstrap/js/bootstrap.min.js"></script>
<script src="${mybasePath}assets/bootstrap/js/jquery.min.js"></script>
<script src="${mybasePath}assets/js/jquery.backstretch.min.js"></script>

<script type="text/javascript">
    function redirToCodeRuleInfo(id) {
        window.location.href = "/codeChangeInfo?codeRuleId="+id;
    }
</script>

</html>